package com.pro.framework.api.model.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.List;

/**
 * 游标分页结果
 */
@Data
@Schema(description = "游标分页结果")
public class CursorPageResult<T> {
    
    @Schema(description = "数据列表")
    private List<T> list;
    
    @Schema(description = "下一个游标值")
    private Long nextCursor;
    
    @Schema(description = "每页大小")
    private Integer pageSize;
    
    @Schema(description = "是否有下一页")
    private Boolean hasNext;
    
    public CursorPageResult(List<T> list, Long nextCursor, Integer pageSize) {
        this.list = list;
        this.nextCursor = nextCursor;
        this.pageSize = pageSize;
        this.hasNext = nextCursor != null && list.size() >= pageSize;
    }
}